home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c
- Subject: Re: (no subject)
- Date: Thu, 25 Jan 1996 14:01:16 +0200
- Organization: Carelcomp Forest
- Message-ID: <3107710C.B26@cmt.lpr.mail.carel.fi>
- References: <4e71v9$iqb@dingo.cc.uq.oz.au>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (WinNT; I)
-
- coonsta@peg.apc.org wrote:
- >
- > Here is the structure and relevant buffer, which contains the data I want
- > to extract (ultimately, I want plain ints):
- >
- > typedef struct pcx_picture_typ
- > {
- > pcx_header header; //Forget it: it's irrelevant
- > RGB_color pallette[256]; //Forget this too.
- > char far *buffer; //That's the one.
- > } pcx_picture, *pcx_picture_pointer;
- > [snip]
- > Anywho... say I have an integer called x, and I want the data in
- > buffer[32000], what would I do? E.G.
- >
- > void main(void)
- > {
- > int x;
- > pcx_picture thepicture;
- >
- > . (The buffer is initialised and filled with data from a file
- > . in here).
- > .
- >
- > x = thepicture.buffer[32000]; // doesn't seem to work.
- > }
- >
-
- Try using
-
- x = (int *)&thepicture.buffer[32000];
- or
- x = (int *)(thepicture.buffer + 32000);
-
- Later,
- AriL
-
- --
- All my opinions are mine and mine alone.
-